<!-- MeasureInfo.vue -->
<template>
  <view class="custom-layout">
	  <wd-collapse v-model="value" class="list" v-if="extensionFile.length>0">
	    <wd-collapse-item
	      v-for="_ in extensionFile"
	      :key="_.value"
	      
	      :name="`measureInfo${_.value}`"
	    >
	      <template #title="{ expanded, disabled, isFirst }">
	       
          <view>
            {{'申请时间:'+dayjs(_.createTime).format('YYYY-MM-DD HH:mm:ss') }}
          </view>
          <view>
            {{'实际竣工时间延期至'+dayjs(_.extensionTime).format('YYYY-MM-DD')}}
          </view>
	      </template>
        <wd-img :width="100" :height="100" v-for="f in _.fileUrl" :src="f" :enable-preview="true"/>
	    </wd-collapse-item>
	  </wd-collapse>
    <wd-status-tip v-else image="content" tip="暂无内容" />


	
  </view>
</template>
<script setup>
import dayjs from 'dayjs';	
import { ref, computed, watch, onMounted, reactive } from 'vue';
import { onReady } from '@dcloudio/uni-app';
import {
  useDictionaryStore,
  useUserStore,
  usePermissionStore 
} from '@/store/index.js'
import { getYanqiFileList,  } from '@/api/engineering/detail.js'
const props = defineProps({
  // 订单id
  orderId: {
    type: Number,
    required: true
  },
});

// 字典仓库
 const dictionaryStore = useDictionaryStore()
 // 用户仓库
 const userStore = useUserStore()
// 权限参数
const permissionStore = usePermissionStore()
const hasPermission = (permissions) => {
	console.log(permissionStore.permissions,'permissions');
	console.log(permissionStore.hasPermission(permissions),'ll');
      return permissionStore.hasPermission(permissions)
    }

const extensionFile = ref([])
const value = ref(['measureInfo1'])
// 处理获取量房信息列表
const handleGetMeasureInfoList = () => {
  uni.showLoading({
			mask: true
		})
  const params = {
    orderId: props.orderId,
     pageSize: -1,
  };
  getYanqiFileList(params)
    .then((data) => {
      if (!data) return;
     data.list.forEach((item)=>{
        item.fileUrl = JSON.parse(item.fileUrl)
      })
      extensionFile.value = data.list
    })
    .catch((error) => {
    	uni.showToast({
    		title: error,
    		icon: 'error'
    	})
    })
    .finally(() => {
      uni.hideLoading();
    });
};

onMounted(() => {
  handleGetMeasureInfoList();

});


</script>
<style lang="scss" scoped>
  .custom-layout {
	  height: calc(100vh - 424px);
  }
</style>